// Copyright (C) 2005 Taylor L. Riché <riche@cs.utexas.edu>
//  
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
// 
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
// 
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software 
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
//
// 	$Id: PhysInterface.hh 390 2006-02-14 17:00:39Z richetl $	
//

#ifndef PHYSINTERFACE_HH
#define PHYSINTERFACE_HH

#include <assert.h>
#include <pthread.h>

#include <string>

#include <errno.h>

#include <sys/socket.h>
#include <netpacket/packet.h>
#include <net/ethernet.h>
#include <net/if.h>
#include <netinet/in.h>
#include <netinet/ip.h>
#include <netinet/tcp.h>
#include <sys/ioctl.h>

#ifdef LEE_BUILD
#include "NetInterface.hh"
#include "PCon.hh"
#include "PlainFunctions.hh"
#include "ProcUnit.hh"
#else
#include <lee/NetInterface.hh>
#include <lee/PCon.hh>
#include <lee/PlainFunctions.hh>
#include <lee/ProcUnit.hh>
#endif

extern int errno;

namespace lee {

  const uint32_t BUFSIZE = 1500;
  typedef int socket_t;

  class PhysInterface : public NetInterface
  {
    unsigned int intfNum;
    pthread_t coreThread;
    socket_t coreSocket;
    sockaddr_ll coreFrom;
    bool fromSet;
  public:
    PhysInterface(std::string intf);
    virtual void process();
    virtual void processData(PktData * const pkt, uint32_t pktSize);
  };

}

#endif // PHYSINTERFACE_HH
